package com.meals.system.common;

/**
 * Description:
 * Parm:
 * return:
 * Author: Chen
 * Date: 2021/12/14
 */
public enum WhitesMealOrderStatusEnum {

    // 订单状态
    // -9 错误
    // 0.待支付
    // 1.已支付
    // 2.配货完成
    // 3.出库成功
    // 4.交易成功
    // -1.手动关闭
    // -2.超时关闭
    // -3.商家关闭
    // -4.管理员关闭


    DEFAULT(-9, "ERROR"),
    ORDER_PRE_PAY(0, "待支付"),
    ORDER_PAID(1, "已支付"),
    ORDER_PACKAGED(2, "配货完成"),
    ORDER_EXPRESS(3, "出库成功"),
    ORDER_SUCCESS(4, "交易成功"),
    ORDER_CLOSED_BY_SYSTEM_USER(-1, "用户关闭"),
    ORDER_CLOSED_BY_EXPIRED(-2, "超时关闭"),
    ORDER_CLOSED_BY_SYSTEM_SELLER(-3, "商家关闭"),
    ORDER_CLOSED_BY_ADMIN(-4, "管理员关闭");


    private int orderStatus;

    private String name;
    WhitesMealOrderStatusEnum(int orderStatus, String name){
        this.orderStatus = orderStatus;
        this.name = name;
    }

    // 根据int 类型返回支付枚举类 WhitesMealOrderStatusEnum
    public static WhitesMealOrderStatusEnum getWhitesMealOrderStatusEnumByStatus(int orderStatus){
        for (WhitesMealOrderStatusEnum whitesMealOrderStatusEnum : WhitesMealOrderStatusEnum.values()){
            if (whitesMealOrderStatusEnum.getOrderStatus() == orderStatus){
                return whitesMealOrderStatusEnum;
            }
        }
        return DEFAULT;
    }

    public int getOrderStatus(){
        return orderStatus;
    }

    public void setOrderStatus(int orderStatus){
        this.orderStatus = orderStatus;
    }

    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }
}
